﻿<Window x:Class="Bugger.Presentation.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:p="clr-namespace:Bugger.Presentation.Properties"
        xmlns:c="clr-namespace:Bugger.Presentation.Converters"
        xmlns:dd="clr-namespace:Bugger.Presentation.DesignData"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" d:DataContext="{d:DesignInstance dd:SampleMainViewModel, IsDesignTimeCreatable=True}"
        Icon="{Binding Mode=OneWay, Source={StaticResource BuggerImageSource}}"
        Title="MainWindow" Height="550" Width="500" Closing="Window_Closing">
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static p:Resources.SystemMenu}">
                <MenuItem Header="{x:Static p:Resources.RefreshMenu}" Command="{Binding RefreshBugsCommand}" Icon="{Binding Mode=OneWay, Source={StaticResource RefreshImage}}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.SettingMenu}" Command="{Binding SettingCommand}" Icon="{StaticResource SettingImage}"/>
                <Separator/>
                <MenuItem Header="{x:Static p:Resources.ExitMenu}" Command="{Binding ExitCommand}"/>
            </MenuItem>
            <MenuItem Header="{x:Static p:Resources.LanguageMenu}">
                <MenuItem Header="{x:Static p:Resources.EnglishMenu}" Command="{Binding EnglishCommand}" Icon="{Binding Mode=OneWay, Source={StaticResource FlagEnImage}}"/>
                <MenuItem Header="{x:Static p:Resources.ChineseMenu}" Command="{Binding ChineseCommand}" Icon="{Binding Mode=OneWay, Source={StaticResource FlagCNImage}}"/>
            </MenuItem>
            <MenuItem Header="{x:Static p:Resources.AboutMenu}" Command="{Binding AboutCommand}"/>
        </Menu>

        <Grid Margin="10,5,10,10">
            <Grid.RowDefinitions>
                <RowDefinition Height="5"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ProgressBar Grid.Row="0" Grid.ColumnSpan="2" Value="100" Foreground="Green"
                             Background="{x:Null}" BorderBrush="{x:Null}" IsIndeterminate="{Binding DataService.InitializeStatus, Converter={x:Static c:InitializeStatusToIndeterminateConverter.Default}}"
                             Visibility="{Binding DataService.InitializeStatus, Converter={x:Static c:InitializeStatusToVisibilityConverter.Default}}"/>
            <TabControl Grid.Row="1" x:Name="documentView" ItemsSource="{Binding DocumentViews}">
                <TabItem Header="{Binding DataService, Mode=OneWay}">
                    <TabItem.HeaderTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="5"/>
                                </Grid.RowDefinitions>
                                <ProgressBar Grid.Row="1" Width="100" Value="{Binding UserBugsProgressValue}" Foreground="{Binding UserBugsQueryState, Converter={x:Static c:QueryStatusToColorConverter.Default}}"
                                         Background="{x:Null}" BorderBrush="{x:Null}" IsIndeterminate="{Binding UserBugsQueryState, Converter={x:Static c:QueryStatusToIndeterminateConverter.Default}}"
                                         Visibility="{Binding UserBugsQueryState, Converter={x:Static c:QueryStatusToVisibilityConverter.Default}}"/>
                                <TextBlock Text="{x:Static p:Resources.UserBugsTitle}"/>
                            </Grid>
                        </DataTemplate>
                    </TabItem.HeaderTemplate>
                    <ContentControl Content="{Binding ShellService.UserBugsView}" Margin="0,0,5,0"/>
                </TabItem>
                <TabItem Header="{Binding DataService, Mode=OneWay}">
                    <TabItem.HeaderTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="5"/>
                                </Grid.RowDefinitions>
                                <ProgressBar Grid.Row="1" Width="100" Value="{Binding TeamBugsProgressValue}" Foreground="{Binding TeamBugsQueryState, Converter={x:Static c:QueryStatusToColorConverter.Default}}"
                                             Background="{x:Null}" BorderBrush="{x:Null}" IsIndeterminate="{Binding TeamBugsQueryState, Converter={x:Static c:QueryStatusToIndeterminateConverter.Default}}"
                                             Visibility="{Binding TeamBugsQueryState, Converter={x:Static c:QueryStatusToVisibilityConverter.Default}}"/>
                                <TextBlock Text="{x:Static p:Resources.TeamBugsTitle}"/>
                            </Grid>
                        </DataTemplate>
                    </TabItem.HeaderTemplate>
                    <ContentControl Content="{Binding ShellService.TeamBugsView}" Margin="0,0,5,0"/>
                </TabItem>
            </TabControl>
        </Grid>
    </DockPanel>
</Window>
